package com.hy.job;

import com.hy.admin.service.YangCardOrderService;
import com.hy.thread.ThreadPoolService;
import com.hy.thread.YangCardExpireThread;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class YangCardExpireJob {

    private static Logger logBase = LoggerFactory.getLogger(YangCardExpireJob.class);
    @Autowired
    private YangCardOrderService yangCardOrderService;

    public void work(){
        logBase.info("YangCardExpireJob.Info:----------start run");
        Boolean result = yangCardOrderService.cardExpire();
        if(!result){
            //修改状态失败，另起线程修改
            ThreadPoolService.addThreadToCommonPool(new YangCardExpireThread());
        }
        logBase.info("YangCardExpireJob.Info:----------start over");
    }
}
